<?php

namespace Cktadmin\Controller;

use Common\Controller\BasicAdmin;

class ConfigController extends BasicAdmin {

    public $table = 'adminConfig';
    public $title = '系统参数配置';

    public function index() {
        if (IS_GET) {
            $this->assign('title', $this->title);
            $this->display();
        }
        if (IS_POST) {
            foreach (I('post.') as $key => $val) {
                sysconf($key, $val);
            }
            $this->success('系统参数配置成功!');
        }
    }

    public function file() {
        $this->title = "文件存储配置";
        $data = array(
            'storage_name' => array('local' => '本地服务器存储', 'qiniu' => '七牛云存储', 'oss' => '阿里云OSS存储'),
            'qiniu_region' => array('华东', '华北', '华南', '北美'),
            'is_https' => array('http', 'https', 'auto'),
        );
        $this->assign('data', $data);
        return $this->index();
    }

    public function user() {
        $this->Index();
    }

}
